//
//  SJPDepartControl.m
//  SWS_Project00
//
//  Created by 马继鵬 on 17/3/9.
//  Copyright © 2017年 SWS. All rights reserved.
//

#import "SJPDepartControl.h"

@interface SJPDepartControl()
@property (weak,nonatomic) UITextField* textField;
@end
@implementation SJPDepartControl

+ (instancetype)departmentControlWithPlaceHolder:(NSString*)placeHolder title:(NSString*)title ID:(NSInteger)ID
{
    
    SJPDepartControl* control = [[SJPDepartControl alloc]init];
    control.tag = ID;
    control.backgroundColor = [UIColor whiteColor];
    //filed
    UITextField* departmentField = [[UITextField alloc]init];
    
    [control addSubview:departmentField];
    departmentField.tag = ID;
    control.textField = departmentField;
    departmentField.enabled = NO;
    departmentField.textColor = [UIColor blackColor];
    departmentField.font = [UIFont systemFontOfSize:20];
    
    departmentField.placeholder = placeHolder;
    
    //位置
    [departmentField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.leading.offset(10);
        make.width.mas_equalTo(357*0.7);
    }];
    //竖线
    UIImageView* separteLine = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"fengexian"]];
    [control addSubview:separteLine];
    [separteLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(departmentField.mas_trailing);
        make.centerY.offset(0);
        make.width.mas_equalTo(1);
        make.height.mas_equalTo(24);
    }];
    //箭头
    UIImageView* arrowImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"illness_button_input_blue.png"]];
    [control addSubview:arrowImage];
    
    [arrowImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(separteLine.mas_trailing).offset(17);
        make.centerY.offset(0);
        make.height.width.mas_equalTo(15);
    }];
    
    
    return control;

    
}


#pragma
#pragma- 赋值
- (void)setTitle:(NSString *)title
{
    _title = title;
    _textField.text = title;
}


@end
